What is @commitlint/parse?
The @commitlint/parse package is used to parse commit messages according to the conventions used by commitlint. It takes a raw commit message string and returns a promise that resolves to an object representing the parsed commit, which includes information such as the header, type, scope, subject, body, footer, and references. This package is typically used in the context of commit message linting to ensure that commit messages follow a certain format.
Parsing commit messages
This feature allows you to parse a commit message and obtain an object with structured information about the commit. The code sample demonstrates how to use the parse function to parse a commit message and log the result.
const parse = require('@commitlint/parse');
const message = 'feat(scope): add new feature';
parse(message).then(commit => {
console.log(commit);
});